<%@page import="com.iflysse.bbs.model.NewsInfo"%>
<%@page import="java.util.List"%>
<%@page import="com.iflysse.bbs.dao.impl.NewsDaoImpl"%>
<%@page import="com.iflysse.bbs.dao.NewsDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="pages/base.jsp" %>
<%
	//获取查询的值（点击查询按钮进来处理）
	String title = null;
	if(request.getParameter("title") != null){
		title = request.getParameter("title").toString();
	}
	
	NewsDao newsDao = new NewsDaoImpl();
	List<NewsInfo> newsList = null;
	if(title == null){
		//默认首页进来
		newsList = newsDao.getNewsList();
	}else{
		//点击查询按钮进来
		newsList = newsDao.getNewsList(title);
	}
	
	request.setAttribute("newsData", newsList);
	request.getRequestDispatcher("/pages/index.jsp").forward(request, response);
%>